package com.nineclock.system.controller;

import com.nineclock.common.entity.Result;
import com.nineclock.system.api.SmsControllerApi;
import com.nineclock.system.service.SmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sms")
public class SmsController implements SmsControllerApi {

    @Autowired
    private SmsService smsService;


    @GetMapping("/code")
    @Override
    public Result sendSmsCode(String mobile, String type) {
        smsService.sendSmsCode(mobile,type);
        return Result.success();
    }


    @GetMapping("/verify")
    @Override
    public Result verifySmsCoe(String checkcode, String mobile, String type) {
        Boolean flag = smsService.verifySmsCode(checkcode, mobile, type);
        return Result.success(flag);
    }
}
